import { numberFormat } from '@/util/util.js'
export const now = new Date();
export const nowDate = (now.getFullYear()).toString()+'-0'+(now.getMonth()+1).toString();
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  addBtn: false,
  viewBtn: false,
  editBtn: false,
  delBtn: false,
  searchMenuSpan: 6,
  column: [{
    "type": "input",
    "label": "唯一标识",
    "prop": "id",
    hide: true,
    display: false
  }, {
    "type": "month",
    "label": "年月",
    "prop": "dateYearMonth",
    format: 'yyyy-MM',
    valueFormat: 'yyyy-MM',
    search: true,
    searchValue: nowDate 
  }, {
    "type": "date",
    "label": "盘点时间",
    "prop": "statisticalTime",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd',
    search: true
  }, {
    "type": "number",
    "label": "合计本月结存",
    "prop": "settleNumber"
  }, {
    "type": "number",
    "label": "合计盘点数量",
    "prop": "checkNumber"
  }, {
    "type": "number",
    "label": "合计差异数量",
    "prop": "differenceNumber"
  }, {
    "type": "input",
    "label": "备注",
    "prop": "remark"
  }, {
    "type": "input",
    "label": "创建人ID",
    "prop": "creatorId",
    hide: true,
    display: false
  }, {
    "type": "input",
    "label": "创建时间",
    "prop": "createTime",
    hide: true,
    display: false
  }, {
    "type": "input",
    "label": "创建人",
    "prop": "creatorName",
    hide: true,
    display: false
  }, {
    "type": "input",
    "label": "部门ID",
    "prop": "deptId",
    hide: true,
    display: false
  }]
};

export const editFormOption = {
  menuBtn: false,
  labelWidth: 150,
  disabled: false,
  column: [{
    "type": "input",
    "label": "年月",
    "prop": "yearMonth",
    disabled: true
  }, {
    "type": "date",
    "label": "盘点时间",
    "prop": "statisticalTime",
    format: 'yyyy-MM-dd',
    valueFormat: 'yyyy-MM-dd'
  }, {
    "type": "number",
    "label": "合计本月结存",
    "prop": "settleNumber",
    span: 8,
    disabled: true
  }, {
    "type": "number",
    "label": "合计盘点数量",
    "prop": "checkNumber",
    span: 8,
    disabled: true
  }, {
    "type": "number",
    "label": "合计差异数量",
    "prop": "differenceNumber",
    span: 8,
    disabled: true
  }]
}

export const detailTableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  menu: false,
  addBtn: false,
  refreshBtn: false,
  columnBtn: false,
  submitBtn: false,
  emptyBtn: false,
  //selection: true,
  column: [{
    label: '票种',
    prop: 'ticketType',
    type: 'select',
    dicUrl: '/support/swpmticketcardtype/dict',
    props: {
      label: 'mainName',
      value: 'mainEnName'
    }
  }, {
    label: '车票名称',
    prop: 'ticketTypeParam',
    type: 'select',
    props: {
      label: 'subName',
      value: 'subEnName'
    },
    dicUrl: '/support/swpmticketcardtypeparam/dictAll',
  }, {
    label: '次数',
    prop: 'ticketTimes'
  }, {
    label: '金额',
    prop: 'ticketPrice',
	type: 'number',
  precision: 2,
  formatter: (row,value,label,column) => {
  return numberFormat(value, column.precision)
}
  }, {
    label: '库区分区',
    prop: 'stockArea',
    type: 'select',
    dicUrl: '/support/swpmticketarea/dict',
    props: {
      label: "ticketAreaName",
      value: "ticketAreaCode"
    }
  }, {
    label: '本月结存',
    prop: 'settleNumber'
  }, {
    label: '盘点数量',
    prop: 'checkNumber',
    type: 'number',
    cell: true
  }, {
    label: '本月差异数量',
    prop: 'differenceNumber'
  }, {
    label: '备注',
    prop: 'remark',
    cell: true
  }]
}
